package com.itheima;

import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;

public class map {
    public static void main(String[] args) {
        ArrayList<String> arr = new ArrayList<>();
        arr.add("zhangsan,24");
        arr.add("lisi,24");
        arr.add("wangwu,25");
        Map<String, Integer> map = arr.stream().filter(
                s ->
                {
                    String[] split = s.split(",");

                    int age = Integer.parseInt(split[1]);

                    return age <= 24;
                }).collect(Collectors.toMap(s -> s.split(",")[0],
                s -> Integer.parseInt(s.split(",")[1])));
        System.out.println(map);

    }
}
